#pragma once
#include "../../utility/thread.h"

#include "../../../include/singleton.h"

#pragma comment(lib, "ws2_32.lib")

#ifdef _DEBUG
#pragma comment(lib, "../../../lib/netd.lib")
#pragma comment(lib, "../../../lib/iocpd.lib")
#pragma comment(lib, "../../../lib/timerd.lib")
#pragma comment(lib, "../../../lib/logd.lib")
#pragma comment(lib, "../../../lib/filelogd.lib")
#pragma comment(lib, "../../../lib/utilityd.lib")
#else
#pragma comment(lib, "../../../lib/net.lib")
#pragma comment(lib, "../../../lib/iocp.lib")
#pragma comment(lib, "../../../lib/timer.lib")
#pragma comment(lib, "../../../lib/log.lib")
#pragma comment(lib, "../../../lib/filelog.lib")
#pragma comment(lib, "../../../lib/utility.lib")
#endif

class CP2PSvrApp :
    public CThread
{
    DECLARE_SINGLETON(CP2PSvrApp)
public:
    CP2PSvrApp(void);
    virtual ~CP2PSvrApp(void);

    bool Init(void);
    void UnInit(void);

    bool Start(void);
    void Stop(void);

    virtual void ThreadProc(void);

    inline bool is_closing(void){return m_is_closing;}

    inline void set_run(bool run){m_run = run;}

protected:
    bool    m_run;
    bool    m_is_closing;
};
